import React from 'react';
import { Button } from 'antd';
import CommonList from '../../../components/CommonLists/list';
import Modal from '../../../components/Modal';
import WarnRecord from './warnRecord';

class RiskMonitorList extends CommonList {
  constructor(props) {
    super(props);
    this.api = 'riskMonitor';
    this.operatorWidth = '15%';
    this.btnGroup = [
      (record) => (
        <Button type='link' onClick={() => this.edit(record, {})}>
          编辑
        </Button>
      ),
      (record) => (
        <Button type='link' onClick={() => this.handleWarnRecord(record)}>
          预警记录
        </Button>
      ),
      (record) => (
        <Button type='link' onClick={() => this.delete(record)}>
          删除
        </Button>
      ),
    ];
  }
  componentDidMount() {}
  handleWarnRecord({ id }) {
    Modal.open({
      title: '预警记录',
      width: '800px',
      content: <WarnRecord {...this.props} id={id} />,
      isOkBtn: false,
      isCancelBtn: true,
      cancel: () => {
        Modal.close();
      },
    });
  }
}

export default RiskMonitorList;
